//
//  TemplateFocusCell.m
//  MVP_DesignModel_OCVersion
//
//  Created by DeLong Yang on 2017/7/21.
//  Copyright © 2017年 DeLongYang. All rights reserved.
//

#import "TemplateFocusCell.h"
#import "TemplateFocusCellContentView.h"
#import "TemplateFloorFocusModel.h"

@implementation TemplateFocusCell
{
    // 内容的view。也是 设置 tapBlock的view
    TemplateFocusCellContentView *contentView_;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        contentView_ = [[TemplateFocusCellContentView alloc]init];
        contentView_.translatesAutoresizingMaskIntoConstraints = NO;
        [self.contentView addSubview:contentView_];
        
        // 设置新的约束
        [contentView_ mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self).insets(UIEdgeInsetsZero);
        }];
        
        
    }
    
    return self;
}

#pragma mark ---- TemplateCellProtocol Delegate

- (void)tapOneBlock:(TapBlock)tapBlock
{
    [contentView_ setTapBlock:tapBlock];
}

- (void)processData:(id<TemplateRenderProtocol>)data
{
    if ([data isKindOfClass:[TemplateFloorFocusModel class]]) {
        [contentView_ processData:data];
    }
}

+ (CGSize)calculateWithData:(id<TemplateRenderProtocol>)data constraindeToSize:(CGSize)size
{
    return CGSizeMake(ScreenWidth, 110);
}








@end
